/**
 * 分类导航数据
 */
import { findHeadCategory } from '@/api/home'
export default {
  namespaced: true,
  state: {
    navs: [] // 定义数据
  },
  mutations: {
    // 存储navs(同步)
    setNavs (state, navs) {
      state.navs = navs
    }
  },
  actions: {
    // 调用后台获取navs的接口
    async getNavsAction ({ commit }, payload) {
      const { result } = await findHeadCategory()
      console.log('分类：', result)
      commit('setNavs', result)
    }
  }
}
